package com.tulingxueyuan.config;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.concurrent.TimeUnit;

/**
 * @author :tangweiliang
 * @date : 2023/2/7 22:42
 * 未来的你会感谢现在努力的自己
 */
@SpringBootApplication
public class ConfigApplication {
    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(ConfigApplication.class,args);

        while(true){
            String userName = applicationContext.getEnvironment().getProperty("user.name");
            String userAge = applicationContext.getEnvironment().getProperty("user.age");
            String userConfig = applicationContext.getEnvironment().getProperty("user.config");

            System.err.println("userName:" +userName+" ;userAge:"+userAge +";userConfig:"+userConfig);
            TimeUnit.SECONDS.sleep(1);
        }
        // nacos客户端 每10s去 注册中心进行判断，根据MD5
    }
}
